Putting it all together, let's say you want to sort by characters 3 to 7 of item 2 of each line, you want the comparison to be done by numeric values, and you want the lines to be in descending order. The command for this would be:
Put MegaSort(unsorted,",",return,"f=2,t=n,d=d,c=char 3 to 7") into sorted
Also included in this stack is an XFCN called AnswerALot and an XFCN called PutPathName. AnswerALot emulates the Answer command in HyperCard, except that it allows up to 15 choices. Look at the script for the last example to see how it works.